package com.gking.aiService.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.gking.aiService.common.Result;
import com.gking.aiService.entity.dao.PagingQueryLogsRecordDao;
import com.gking.aiService.entity.SyLogsRecord;
import com.gking.aiService.service.LogsRecord.LogsRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/logsRecord")
public class LogsRecordController {

    @Autowired
    private LogsRecordService logsRecordService;


    /**
     * 添加日志记录
     *
     * @param logsRecord 日志信息
     */
    private void addLogsRecord(SyLogsRecord logsRecord) {
    }


    /**
     * 分页获取日志记录列表
     *
     * @param page         分页页码
     * @param size         分页大小
     * @param conditionDto 条件
     * @return s
     */
    @RequiresPermissions("AS:manager:query:logs")
    @PostMapping("/getPageLogsRecordList")
    public Result<Page> getPageLogsRecordList(@RequestParam Integer page, @RequestParam Integer size,
                                              @RequestBody PagingQueryLogsRecordDao conditionDto) {
        if (page == null) page = 1;
        if (size == null) size = 20;
        try {
            return logsRecordService.getPageLogsRecordList(page, size, conditionDto);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
    }


}
